/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BLL;

import DAL.ConnectUnit;
import java.sql.ResultSet;
import java.util.Date;
import javax.swing.JComboBox;

/**
 *
 * @author Nguyen Phi Hung
 */
public class Unity {
    ConnectUnit conn;
    
    public Unity(){
        conn = DAL.DAL.getDAL();
    }
    
    public void load_combobox(JComboBox cb,String table,String column) throws Exception
    {
        ResultSet rss=conn.Select(table);
        while(rss.next())
        {
            String k=rss.getString(column);
            cb.addItem(k);
        }
    }
    
    public String toString(Date date){
        return new String(date.getDate()+ "/"+ (date.getMonth()+1)+"/"+ (date.getYear()+1900));
    }
}
